//固定语法，new Vue({}) 在大括号里面写代码
new Vue({
    //5.指明vue作用域  <div id="app"></div>
    el: '#query',
    //6.数据区
    data() {
        return {
            tableData: '',
            lim: 4,
            page: 1,
            query: {
                jobType: '',
                jobPlace: '',
                salary: '',
                jobStart: '',
                salaryMode:'',
            },
            total1: 10,
            perWorkHour: '',
            jobStartTime: '',
            jobTypes: ['', '老师', '服务员', '外卖起手', '收银员', '快递'],
            jobPlaces: ['', '南岸', '渝中', '东南', '渝北', '弹子石']
        }
    },
    methods: {
        getData() {
            let that = this
            console.log("page:" + this.page)
            let url = 'http://localhost:8002/service_job/job/pageFind/' + this.page + '/' + this.lim
            axios
                .post(url, that.query)
                .then(response => {
                    this.tableData = response.data.data.jobs;
                    this.total1 = response.data.data.total1 / this.lim * 10;
                    console.log(this.tableData)
                    // this.$message({type: 'success', message: "由于数据太少，一页就放两条。" + '当前页为' + this.page});
                })
                .catch(function (error) { // 请求失败处理
                    console.log(error);
                });
        },
        sortJobsBySalary() {
            let that = this
            axios.post('/part_time_job/sortJobsBySalary', this.tableData).then(response => {
                that.tableData = response.data.data.partTimeJobs;
                console.log(that.tableData)
            })
        }, log() {
            console.log(this.type)
        },
        sortJobsByStart() {
            let that = this
            axios.post('/part_time_job/sortJobsBySalary', this.tableData).then(response => {
                that.tableData = response.data.data.partTimeJobs;
                console.log(that.tableData)
            })
        }, log() {
            console.log(this.type)
        },
    }
})

